﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Models;

namespace carpool.lixioacheng
{
    public partial class 车主发布长途拼车 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btn_fabu_Click1(object sender, EventArgs e)
        {
          
        }

        protected void btn_fabu_Click(object sender, EventArgs e)
        {
            //创建对象
            //难点:唯一序列
            LongLine model = new LongLine();

            model.GoCity = this.tb_gocity.Text;
            model.ToCity = this.tb_mudi.Text;
            //model.GoTime = Convert.ToDateTime(this.tb_gotime.Text);
            model.CJpeople = Convert.ToInt32(this.tb_addren.Text);
            model.RNpeople = Convert.ToInt32(this.tb_rongna.Text);
            if (this.rb_car.Text == "轿车")
            {
                this.rb_car.Checked = true;
            }
            if (this.rb_mpv.Text == "MPV")
            {
                this.rb_mpv.Checked = true;
            }
            if (this.rb_suv.Text == "SUV")
            {
                this.rb_suv.Checked = true;
            }
            if (this.rb_paoche.Text == "跑车")
            {
                this.rb_paoche.Checked = true;
            }
            if (this.rb_keche.Text == "客车")
            {
                this.rb_keche.Checked = true;
            }
            if (this.rb_qita.Text == "其他")
            {
                this.rb_qita.Checked = true;
            }
            //费用方式
            if (this.rb_free.Text == "免费")
            {
                this.rb_free.Checked = true;
            }
            if (this.rb_mianyi.Text == "面议")
            {
                this.rb_mianyi.Checked = true;
            }
            if (this.rb_yikoujia.Text == "一口价")
            {
                this.rb_yikoujia.Checked = true;
                model.CostWays = this.tb_money.Text;
            }
            model.Says = this.tb_chezhu.Text;
            bool result = LongLineBLL.AddLine(model);
            if (result)
            {
                Response.Redirect("添加成功");
            }
            else
            {
                Response.Redirect("添加失败");
            }
        }
    }
}